#pragma once
#include "..\Controls\ListCtrl.h"
#include "..\DataManager\ArticleManager.h"

class CAddTagDlg 
	: public CBkDialogImpl<CAddTagDlg>
	,public CWHRoundRectFrameHelper<CAddTagDlg>
{
public:
	CAddTagDlg(int id)
		: CBkDialogImpl<CAddTagDlg>(IDR_BK_ADDTAG_DLG),m_nID(id)
	{
		m_TagList = NULL;
	}

	~CAddTagDlg(void)
	{		
	}
	BOOL doApply();
	LRESULT		OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	BOOL		OnInitDialog(HWND wParam, LPARAM lParam);	
	LRESULT		OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	void		OnBkBtnClose();
	void		OnBkBtnSure();	
	void		OnAddTag();
	
public:
	BK_NOTIFY_MAP(IDC_RICHVIEW_WIN);
		BK_NOTIFY_ID_COMMAND(IDC_BTN_SYS_CLOSE,					OnBkBtnClose)
		BK_NOTIFY_ID_COMMAND(IDC_BTN_DLG_OK,			OnBkBtnSure)
		BK_NOTIFY_ID_COMMAND(IDC_BTN_DLG_CANCEL,		OnBkBtnClose)		
		BK_NOTIFY_ID_COMMAND(IDB_DLG_ART_TAG_BTN_ADD,		OnAddTag)	
		
	BK_NOTIFY_MAP_END()

	BEGIN_MSG_MAP_EX(CAddTagDlg)	
		MSG_BK_NOTIFY(IDC_RICHVIEW_WIN)
		CHAIN_MSG_MAP(CBkDialogImpl<CAddTagDlg>)
		CHAIN_MSG_MAP(CWHRoundRectFrameHelper<CAddTagDlg>)
		MESSAGE_HANDLER(WM_CREATE,				OnCreate)
		MESSAGE_HANDLER(WM_DESTROY,				OnDestroy)	
		MSG_WM_INITDIALOG(OnInitDialog)	

		REFLECT_NOTIFICATIONS_EX()
	END_MSG_MAP()		 

private:
	void _init();
	void RefreshTags();
	CArticleManager			m_ArtMag;
	CEdit					m_wndEditTitle;
	CListCtrl				m_wndTagList;
	TagList*				m_TagList;
	int						m_nID;
};